/**
 * 标准的 dart 模型类
 */
class ResponseResult<T> {
  bool? success;
  T? data;
  String? msg;
  int? code;

  ResponseResult({this.success,this.data,this.msg,this.code});
  factory ResponseResult.fromJson(Map<String,dynamic> map){
    return ResponseResult<T>(
      success: map['success'],
      data: map['data'],
      msg: map['msg'],
      code: map['code'],
    );
  }
  factory ResponseResult.empty(){
    return ResponseResult<T>(
      success: false,
      msg: 'empty',
      code: -1,
    );
  }

  Map<String,dynamic> toJson(){
    final Map<String,dynamic> jsonData = <String,dynamic>{};
    jsonData['success'] = success;
    jsonData['data'] = data;
    jsonData['msg'] = msg;
    jsonData['code'] = code;
    return jsonData;
  }

}